package ycl.important.controller.hovel;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.important.common.ApiResult;
import ycl.important.common.models.req.base.SmsReq;
import ycl.important.service.hovel.SmsService;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 发送短信 控制器
 *
 * @author: YCL
 * @date: 2021-06-16 13:01:05
 */
@RestController
@RequestMapping("/hovel/sms")
@Api(tags = "发送短信")
@ApiSort(10)
public class SmsController {

	@Resource
	private SmsService smsService;

	@PostMapping("/registerByUsername")
	@ApiOperation("注册获取验证码")
	@ApiOperationSupport(order = 1)
	public  ApiResult<T> registerByUsername(@RequestBody @Valid SmsReq dto){
		smsService.registerByUsername(dto);
		return ApiResult.success();
	}


	@PostMapping("/sendEmail")
	@ApiOperation("测试发送邮件验证码")
	@ApiOperationSupport(order = 1)
	public  ApiResult<T> sendEmail(){
		smsService.testSendEmail();
		return ApiResult.success();
	}
}
